﻿using System;
using System.Collections.Generic;

namespace Silver3D.Graphics
{
    public class Mesh : Geometry
    {
        private List<PrimitiveSet> subMeshes = new List<PrimitiveSet>();

        public int SubMeshCount { get { return subMeshes.Count; } }

        public Mesh(Scene scene, string id)
            : base(scene, id)
        {
        }

        public Mesh(Scene scene, string id, string name)
            : base(scene, id, name)
        {
        }

        public PrimitiveSet GetSubMesh(int index)
        {
            return subMeshes[index];
        }

        public PrimitiveSet AddSubMesh()
        {
            PrimitiveSet ps = new PrimitiveSet();
            subMeshes.Add(ps);
            return ps;
        }

        public bool RemoveSubMesh(PrimitiveSet ps)
        {
            if (ps == null) return false;
            return subMeshes.Remove(ps);
        }
    }
}
